﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using DataFileProvider;

namespace FileAccessTests
{
    [TestClass]
    public class OffsetAccessTest
    {
        [TestMethod]
        public void CanReadFirst()
        {
            string path = @"..\..\TestFiles\tiny.txt";
            FileInfo file = new FileInfo(path);
            WordNetFile fileSource = new WordNetFile(file);
            string expectedValue = "'abash yuiuyiu 789 iuyiyi 8966765";
            Assert.AreEqual(expectedValue, fileSource.ReadLine(3).Trim());
        }

        [TestMethod]
        public void CanReadLast()
        {
            string path = @"..\..\TestFiles\tiny.txt";
            FileInfo file = new FileInfo(path);
            WordNetFile fileSource = new WordNetFile(file);
            string expectedValue = "vexed zzzzz ww dfhfdhh 5547454";
            Assert.AreEqual(expectedValue, fileSource.ReadLine(806).Trim());
        }

        [TestMethod]
        public void CanReadBegining()
        {
            string path = @"..\..\TestFiles\tiny.txt";
            FileInfo file = new FileInfo(path);
            WordNetFile fileSource = new WordNetFile(file);
            string expectedValue = "blimp jjjjj kkkk llll ghjjkj 999"; 
            Assert.AreEqual(expectedValue, fileSource.ReadLine(87).Trim());
        }

        [TestMethod]
        public void CanReadEnd()
        {
            string path = @"..\..\TestFiles\tiny.txt";
            FileInfo file = new FileInfo(path);
            WordNetFile fileSource = new WordNetFile(file);
            string expectedValue = "radiotelegraphy dfgh 456 rty";
            Assert.AreEqual(expectedValue, fileSource.ReadLine(689).Trim());
        }
    }
}
